home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 13 / CU Amiga Magazine's Super CD-ROM 13 (1997)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1997-08].iso / CUCD / Graphics / Ghostscript / doc / fonts.txt < prev    next >
Text File  |  1997-04-12  |  21KB  |  487 lines

  1.    Copyright (C) 1990, 1995, 1996 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17.  
  18. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  19.  
  20. This file, fonts.txt, describes the fonts and font facilities supplied
  21. with Ghostscript.
  22.  
  23. For an overview of Ghostscript and a list of the documentation files, see
  24. README.
  25.  
  26. About Ghostscript fonts
  27. =======================
  28.  
  29. Most of the font files supplied with Ghostscript have a .pfb extension; a
  30. few have a .pfa or .gsf extension.  Each file defines one (transformable)
  31. font specified in outline form.  They are ordinary Type 1 PostScript outline
  32. fonts, and can be given to any PostScript language interpreter.  Files with
  33. .pfa or .pfb extension are also compatible with Adobe Type Manager and with
  34. tools that don't include a full PostScript language interpreter; files with
  35. .gsf extension are not compatible with ATM or other tools.  Starting with
  36. release 4.0, Ghostscript configurations compiled with the `ttfont' option
  37. can also use TrueType fonts (.ttf), but since Ghostscript's TrueType
  38. rasterizer currently ignores the `hints', the output is not of very good
  39. quality.
  40.  
  41. The only other font-related file that Ghostscript needs for proper operation
  42. is a file called Fontmap.  This file maps font names (such as /Times-Roman)
  43. to font file names (such as n021003l.pfb) or aliases (such as
  44. NimbusNo9L-Regu).
  45.  
  46. The free fonts supplied with Ghostscript fall into three groups:
  47.  
  48.     - 35 basic PostScript fonts (Times, Helvetica, Courier, Symbol,
  49.     etc.)  These are commercial-quality Type 1 fonts.  See the file
  50.     `Fontmap' for the complete list.
  51.  
  52.     - Fonts derived from the public domain Hershey fonts, with
  53.     improvements (such as adding accented characters) by Thomas Wolff.
  54.     These are quite different from traditional printer or display fonts;
  55.     the file `hershey.txt' describes them in more detail.
  56.  
  57.     - A few miscellaneous fonts including Cyrillic and kana fonts.
  58.  
  59. The 35 basic fonts are normally distributed in a file called
  60. `ghostscript-fonts-std-N.NN.tar.gz', the rest in a file called
  61. `ghostscript-fonts-other-N.NN.fonts.tar.gz'.
  62.  
  63. The file gs_fonts.ps, which is loaded as part of Ghostscript initialization,
  64. arranges to load fonts on demand using the information from Fontmap.  If you
  65. want to preload all of the known fonts, invoke the procedure
  66.     loadallfonts
  67. This is not done by default, since the fonts occupy about 50K each and there
  68. are a lot of them.
  69.  
  70. If you want to try out the fonts, prfont.ps contains code for printing a
  71. sampler.  Load this program, by including it in the gs command line or by
  72. invoking
  73.     (prfont.ps) run
  74. and then to produce a sampler of a particular font, invoke
  75.     /fontName DoFont
  76. e.g.
  77.     /Times-Roman DoFont
  78.  
  79. About the Kanji fonts
  80. ---------------------
  81.  
  82. Mr. Tetsurou Tanaka of the Department of Engineering, University of Tokyo,
  83. has created a set of free Kanji fonts that is freely available on the
  84. Internet for anonymous FTP from moe.ipl.t.u-tokyo.ac.jp:/Font and is
  85. distributed with Ghostscript.  Anyone can use these fonts as they are or
  86. with some format translation, and redistribute them without reporting.  If
  87. you redistribute them, you must inform the recipient that he can get the
  88. original from the abovementioned FTP site, so that he could get the newest
  89. version later.
  90.  
  91. The fonts include a README file in Japanese.  Here is some English
  92. documentation supplied by Mr. Kiyotaka Sakai, also of the University of
  93. Tokyo.
  94.  
  95.     The following four fonts are different styles of the same characters
  96.     (JISX208). These fonts also needs wadalab-sym.tar.Z in common.
  97.  
  98.     wadalab-mincho-0-8.tar.gz
  99.     wadalab-mincho-0-12.6.tar.gz
  100.     wadalab-gothic-0-13.5.tar.gz
  101.     wadalab-maru-0-8.4.tar.gz
  102.  
  103.     And the following two fonts are the other different styles of the same
  104.     characters(JISX0212).
  105.  
  106.     wadalab-mincho-1-8.tar.gz
  107.     wadalab-maru-1-8.tar.gz
  108.  
  109.     These fonts are postscript(type1) fonts. You can convert them to
  110.     Metafont, Type1(PFA) font, TeX font(for japanese TeX), BDF font,
  111.     Shotaikurabu font by using wftomf.c, wftopfa.c, wftodm.c, bdfmerge.c
  112.     wftovf.c in tools directory.
  113.  
  114. In order to conform to MS-DOS naming restrictions, we have renamed the
  115. original font files as follows:
  116.     Name        Original name
  117.     ----        -------------
  118.     got013-5.taz    wadalab-gothic-0-13.5.tar.gz
  119.     mar08-4.taz    wadalab-maru-0-8.4.tar.gz
  120.     mar18.taz    wadalab-maru-1-8.tar.gz
  121.     min012-6.taz    wadalab-mincho-0-12.6.tar.gz
  122.     min08-4.taz    wadalab-mincho-0-8.4.tar.gz
  123.     min18.taz    wadalab-mincho-1-8.tar.gz
  124.     sym-4.taz    wadalab-sym.4.tar.gz
  125.  
  126. Platform fonts
  127. ==============
  128.  
  129. Starting with release 2.6.1, Ghostscript uses whatever font technology is
  130. provided by the system on which it runs, by using the system's API for
  131. displaying text.  On MS Windows this may be TrueType, or it may be ATM;
  132. Ghostscript neither knows nor cares.
  133.  
  134. The PostScript language specifies that fonts are data structures with
  135. particular contents (e.g., they include a bounding box for the font, an
  136. Encoding vector for specifying the character set, etc.), and it is fairly
  137. common for PostScript files to make use of this fact; also, characters can
  138. be used as clipping regions, and can be arbitrarily rotated, skewed,
  139. expanded/condensed, etc. algorithmically.  Most of this information is
  140. available in one form or another from the underlying graphics system, but
  141. one crucial piece is not: the actual scalable outlines of the characters,
  142. which Ghostscript needs in order to implement clipping with character
  143. shapes and to implement arbitrarily transformed characters.  Consequently,
  144.  
  145.     Ghostscript needs the scalable outlines of any font mentioned
  146.     in a document, and will load them from the disk (.PFA, .PFB, or
  147.     .GSF file) in the usual way, even if it uses the platform's font
  148.     machinery for displaying the characters.
  149.  
  150. To make matters worse, platforms use different names for their standard
  151. fonts.  For example, the Times Roman font, for which PostScript files use
  152. the name "Times-Roman", may be known as "Times-Roman", "Times Roman", "Tms
  153. Rmn", "Times New Roman", or "TimesNewRoman".  The name may even be
  154. completely different: the usual Helvetica-equivalent TrueType font is
  155. called "Arial".  Now, it is possible to cope with this situation by
  156. introducing aliases in Fontmap, but there are two reasons why the
  157. current Ghostscript release does not do this:
  158.  
  159.     1) Naming in different systems is so unstandardized that there
  160. does not seem to be a small set of alternative names that is likely to
  161. cover most of the situations.  All 5 of the above names for Times Roman
  162. have been seen in Windows and OS/2 environments, depending on system
  163. version, TrueType vs.  ATM, and other unknown factors.
  164.  
  165.     2) Each alias takes up a substantial amount of space (several
  166. hundred bytes) at run time.  If each of the standard 35 fonts has 3
  167. additional aliases, this might amount to 50K of wasted space.  This is a
  168. lot on a PC, although running under Windows in enhanced mode, it might not
  169. be a problem.
  170.  
  171. If you don't seem to be getting nice characters on the screen under MS
  172. Windows, you can try adding aliases to the Fontmap, according to the
  173. documentation found there.
  174.  
  175. Adding your own fonts
  176. =====================
  177.  
  178. Ghostscript can use any Type 0, Type 1, Type 3, Type 4, or Type 42 font that
  179. is acceptable to other PostScript language interpreters or to ATM, including
  180. MultiMaster fonts.  Starting with release 4.0, Ghostscript can also use
  181. TrueType fonts (if Ghostscript was compiled with the `ttfont' option).
  182. Ghostscript also provides a way to construct a (low-quality) Type 1 font
  183. from a bitmap font in BDF format, which is a popular format in the Unix
  184. world.
  185.  
  186. If you want to add fonts of your own, you must edit Fontmap to include an
  187. entry for your new font at the end.  The format for entries is documented
  188. in the Fontmap file.  Since later entries in Fontmap override earlier
  189. entries, any fonts you add will supersede the corresponding fonts supplied
  190. with Ghostscript.
  191.  
  192. In the PC world, Type 1 fonts are customarily given names ending in .PFA or
  193. .PFB.  Ghostscript can use these directly; you just need to make the entry
  194. in Fontmap.  If you are going to use a commercial Type 1 font (such as fonts
  195. obtained in conjunction with Adobe Type Manager) with Ghostscript, please
  196. read carefully the license that accompanies the font; Aladdin Enterprises
  197. takes no responsibility for any possible violations of such licenses.  The
  198. same applies to TrueType fonts, whose names customarily end in .TTF.
  199.  
  200. Converting BDF fonts
  201. --------------------
  202.  
  203. If you want to convert a BDF file to a scalable outline, use the program
  204. bdftops.ps (and invoking shell script bdftops.bat or bdftops).  Run the
  205. shell command
  206.     bdftops <BDF_file_name> [<AFM_file1_name> ...] <your_gsf_file_name>
  207.       <font_name> <uniqueID> [<XUID>] [<encoding_name>]
  208. e.g.,
  209.     bdftops pzdr.bdf ZapfDingbats.afm pzdr.gsf
  210.       ZapfDingbats 4100000 1000000.1.41
  211. (Obviously, you would enter this all on one line; the example is split so
  212. it will fit on the page.)  Then make an entry for the .gsf file in Fontmap
  213. as described above.  See the end of this document for more detail.
  214.  
  215. For developers only
  216. ===================
  217.  
  218. The rest of this document is very unlikely to be of value to ordinary
  219. users.
  220.  
  221. Contents of fonts
  222. -----------------
  223.  
  224. As noted above, Ghostscript accepts fonts in the same formats as PostScript
  225. interpreters.  Type 0, 1, and 3 fonts are documented in the PostScript
  226. Language Reference Manual (Second Edition); detailed documentation for Type
  227. 1 fonts appears in a separate Adobe book.  Type 42 (encapsulated TrueType)
  228. fonts are documented in an Adobe supplement; the TrueType format is
  229. documented in publications available from Apple and Microsoft.  Type 4 fonts
  230. are not documented anywhere; they are essentially Type 1 fonts with a
  231. BuildChar or BuildGlyph procedure.
  232.  
  233. Precompiling fonts
  234. ------------------
  235.  
  236. You can compile any Type 1 font into C and link it into the Ghostscript
  237. executable.  (Type 1 fonts include any font whose name ends with .pfa or
  238. .pfb, and it also includes all the Ghostscript .gsf fonts except for the
  239. Hershey fonts.)  This doesn't have any effect on rendering speed, but it
  240. eliminates the time for loading the font dynamically, which may make a big
  241. difference in total rendering time, especially for multi-page documents.
  242. (Because of RAM and compiler limitations, you should only use compiled fonts
  243. on MS-DOS systems if you are using a 32-bit compiler such as Watcom C/386 or
  244. djgpp; you will run out of memory if you use compiled fonts with the Borland
  245. compiler in a 16-bit environment.)  Fonts that have been precompiled and
  246. linked in this way do not need to appear in the Fontmap, although if they do
  247. appear there, no harm is done.
  248.  
  249. The utility for precompiling fonts is called font2c.  Note that font2c is
  250. a PostScript language program, so you must have Ghostscript already
  251. running to be able to run font2c; you must also have entries in the
  252. Fontmap for the fonts you want to compile.  For example, to precompile
  253. the Times-Italic font,
  254.     font2c Times-Italic ptmri.c
  255. where the first argument is the font name and the second is the name of
  256. the .c file.  You can use any file name you want, as long as it ends in
  257. .c.  It doesn't have to be limited to 8 characters, unless your operating
  258. system requires this.  We suggest that you use names xxxx.c, where
  259. xxxx.gsf or xxxx.pfa is the name of the font file in the Fontmap file,
  260. just so you don't have to keep track of another set of names.  (If you are
  261. running on a VMS platform, or another platform where the C compiler has a
  262. limit on the length of identifiers, you must do something slightly more
  263. complicated; see the section 'Platforms with identifier length limits'
  264. below.  Also, on VMS, you must put quotes "" around the font name so that
  265. the VMS command processor doesn't convert the name to lower case.)
  266.  
  267. For VMS environments, see the directions in the file make.txt, and ignore
  268. the rest of this section.
  269.  
  270. Note that ncrr.c, ptmr.c, etc. are not supplied with the Ghostscript
  271. fileset, since they are quite large and can easily be recreated using the
  272. font2c program as described above.  There is a makefile called cfonts.mak
  273. that will run font2c on all the fonts supplied with Ghostscript.  Invoke it
  274. with
  275.     make -f cfonts.mak
  276. On some systems, you may have to omit the space following the -f, i.e.,
  277.     make -fcfonts.mak
  278.  
  279. Besides running font2c, you must arrange things so that the fonts will be
  280. compiled, and linked into the executable.  To do this, add the compiled
  281. fonts "feature" to your platform-specific makefile.  On MS-DOS systems, you
  282. edit tc.mak, bc.mak, bcwin.mak, msc.mak, or watc.mak; on Unix systems, you
  283. edit ansihead.mak, cc-head.mak, or gcc-head.mak, and then execute tar_cat.
  284. Find the definition of the FEATURE_DEVS macro in the makefile, e.g.,
  285.     FEATURE_DEVS=level2.dev pdf.dev
  286. and add ccfonts.dev, e.g.,
  287.     FEATURE_DEVS=level2.dev pdf.dev ccfonts.dev
  288.  
  289. Next, you must add the specific fonts to the generic makefile.  On MS-DOS
  290. systems, you edit gs.mak; on Unix systems, you edit makefile.  The makefile
  291. already has rules for the standard 35 fonts supplied with Ghostscript.
  292. Find the line in the relevant makefile that says
  293.     #ccfonts1_=<something>
  294. Remove the # mark from this line, and from all the following lines down to
  295. and including the one that says
  296.     #ccfonts9=<something>
  297. This is all you need to do for the standard fonts.  The next couple of
  298. paragraphs describe how to compile in other fonts, such as the Utopia or
  299. Kana fonts or your own fonts.
  300.  
  301. Suppose you want to compile the Kana fonts into the executable.  First,
  302. pick one of ccfonts10 through 15 as the place you will do this, say
  303. ccfonts10.  Add your compiled font file names, e.g.,
  304.     ccfonts10_=fhirw.$(OBJ)
  305. If the line gets too long, use another line of the same form, e.g.,
  306.     ccfonts11_=fkarw.$(OBJ)
  307. Just below this, you will find a line that says
  308.     ccfonts10_=
  309. Add your own fonts to the end of this line, e.g.,
  310.     ccfonts10=Calligraphic_Hiragana
  311. Notice that you must replace `-' by `_' in the font name.  Again, if
  312. the line gets too long, add another line of the same form, e.g.,
  313.     ccfonts10=Calligraphic_Hiragana
  314.     ccfonts11=Calligraphic_Katakana
  315.  
  316. After all the lines of this form, add a pair of lines to compile each font,
  317. separating these entries from the ccfonts* lines and from each other by a
  318. blank line.  In our example:
  319.  
  320.     fhirw.$(OBJ): fhirw.c $(CCFONT)
  321.         $(CCCF) fhirw.c
  322.  
  323.     fkarw.$(OBJ): fkarw.c $(CCFONT)
  324.         $(CCCF) fkarw.c
  325.  
  326. Finally, run `make'.  The executable will now include the fonts you added.
  327. They will be present in FontDirectory when Ghostscript starts up.
  328.  
  329. Precompiling fonts on platforms with identifier length limits
  330. -------------------------------------------------------------
  331.  
  332. On some platforms, the C compiler and/or linker have a limit on the number
  333. of significant characters in an identifier.  On such platforms, you must
  334. do a little extra work.
  335.  
  336. Let N be the maximum number of significant characters in an identifier
  337. (typically 31).  For each font whose name is longer than N-5 characters,
  338. pick an arbitrary identifier that we will call the "short name".  This can
  339. be any string you want, as long as it contains only letters, digits, and
  340. underscores; is no longer than N-5 characters; and is not the same as any
  341. other font name or short name.  A good choice for this would be to use the
  342. name of the C file.  (There is no harm in doing this for fonts with names
  343. shorter than N-5 characters, it's just not necessary.)
  344.  
  345. You must do two different things for fonts that require a short name.
  346. First, you must supply the short name as a third argument to the font2c
  347. program.  For example, to compile NewCenturySchlbk-BoldItalic using the
  348. short name "pncbi",
  349.     font2c NewCenturySchlbk-BoldItalic pncbi.c pncbi
  350. Then when you add the font to the gsaddmod line in the makefile, use the
  351. short name, not the actual font name, e.g.,
  352.     ccfonts2=pncbi
  353. instead of
  354.     ccfonts2=NewCenturySchlbk_BoldItalic
  355. Everything else is as described above.
  356.  
  357. This procedure doesn't change the name of the font in the Fontmap, or as
  358. seen from within Ghostscript; it's just a workaround for a limitation of
  359. some older compilers.
  360.  
  361. Font names and unique IDs
  362. -------------------------
  363.  
  364. If you create your own fonts, and are only going to use them within your own
  365. organization, you should use UniqueID values between 4000000 and 4999999 as
  366. described just below; if you are going to distribute fonts, call Adobe and
  367. get them to assign you some UniqueIDs and also an XUID for your
  368. organization.  The current (September 1993) UniqueID Coordinator is Terry
  369. O'Donnell; he is very helpful and will probably be able to assign you the
  370. numbers over the phone.
  371.  
  372. The suggested temporary UniqueID for a font looks like:
  373.     4TTWVE0
  374. where
  375.     TT is a two-digit number representing the typeface,
  376.     W represents the weight (normal, bold, ...),
  377.     V represents the variant (normal, italic, oblique, ...), and
  378.     E represents the expansion (normal, condensed, ...).
  379. This scheme will not work forever.  As soon there are more 99 typefaces, or
  380. more than 9 weights or variants, we will have to do something else. But it
  381. suffices for the near future.
  382.  
  383. XUIDs are a Level 2 PostScript feature that serves the same function as
  384. UniqueIDs, but is not limited to a single 24-bit integer.  The bdftops
  385. program creates XUIDs of the form [-X- 0 -U-] where -X- is the organization
  386. XUID and -U- is the UniqueID.  (Aladdin Enterprises' organization XUID is
  387. 107; do not use this for your own fonts that you distribute.)
  388.  
  389. Ghostscript fonts are stored on files, and the file names must comply
  390. with the 8-character limit imposed by MS-DOS and other operating systems.
  391. We therefore construct the filename for a font in a way somewhat similar to
  392. the construction for temporary UniqueIDs:
  393.     FTTWVVVE.gsf
  394. where F is the foundry, TT a two-letter abbreviation for the typeface, and
  395. W, V, and E the weight, variant, and expansion.  Since a font can have
  396. multiple variants, we allocate three letters to that (for example, Lucida
  397. Regular Sans Typewriter Italic).  If a font has four variants, you're on
  398. your own.  If a font does have multiple variants, it's best to add the
  399. expansion letter `r', so that it is clear which letters are variants and
  400. which the expansion.
  401.  
  402. This scheme is very close to the one proposed in `Filenames for fonts',
  403. published in the first 1990 issue of TUGboat (the journal of the TeX Users
  404. Group).
  405.  
  406. In the following tables, we made no attempt to be exhaustive.  Instead, we
  407. have simply allocated entries for those things that we needed for the fonts
  408. that we are actually distributing.
  409.  
  410. foundries:
  411. ----------
  412. b = Bitstream
  413. f = freely distributable/public domain fonts
  414. n = IBM
  415. p = Adobe (`p' for PostScript)
  416. u = URW[++]
  417.  
  418. typefaces:
  419. id   name              filename prefix
  420. ----------------------------------------------------------------
  421. 08 = Avant Garde        = pag        (Adobe)
  422. 11 = Bookman            = pbk        (Adobe)
  423. 01 = CharterBT            = bch        (Bitstream)
  424. 02 = Courier            = ncr        (IBM)
  425. 03 = Helvetica            = phv        (Adobe)
  426. 04 = New Century Schoolbook    = pnc        (Adobe)
  427. 09 = Palatino            = ppl        (Adobe)
  428. 05 = Symbol            = psy        (Adobe)
  429. 06 = Times            = ptm        (Adobe)
  430. --   Utopia            = put        (Adobe)
  431. 07 = Zapf Chancery        = zc        (public domain)
  432. 10 = Zapf Dingbats        = pzd        (Adobe)
  433. 12 = public domain Cyrillic    = fcy        (public domain)
  434. 13 = Kevin Hartig Hiragana    = fhi        (shareware)
  435. 14 = Kevin Hartig Katakana    = fka        (shareware)
  436.  
  437. 90 = Hershey Gothic English    = hrge
  438. 91 = Hershey Gothic Italian    = hrit
  439. 92 = Hershey Gothic German    = hrgr
  440. 93 = Hershey Greek        = hrgk
  441. 94 = Hershey Plain        = hrpl
  442. 95 = Hershey Script        = hrsc
  443. 96 = Hershey Symbol        = hrsy
  444.  
  445. weights:
  446. --------
  447. 0 = normal            = r
  448. 1 = bold            = b
  449. 2 = book            = k
  450. 3 = demi            = d
  451. 4 = light            = l
  452.  
  453. variants:
  454. ---------
  455. 0 = normal            = r (omitted when the weight is normal)
  456. 1 = italic            = i
  457. 2 = oblique            = o
  458. 3 = script/handwritten/swash    = w
  459.  
  460. expansions:
  461. -----------
  462. 0 = normal            = r (omitted when the weight and variant
  463.                                    are normal)
  464. 1 = narrow            = n
  465.  
  466. Converting BDF fonts to .gsf (Type 1) fonts
  467. -------------------------------------------
  468.  
  469. The bdftops conversion program takes the following arguments:
  470.  
  471.     bdftops xx.bdf [yy1.afm ...] zz.gsf fontname UniqueID [XUID]
  472.       [encodingname]
  473.  
  474. These arguments have the following meanings:
  475.  
  476.     xx.bdf - the input bitmap file, a BDF file
  477.     yy*.afm - the AFM files giving the metrics (optional)
  478.     zz.gsf - the output file
  479.     fontname - the font name
  480.     UniqueID - the UniqueID, as described above
  481.     XUID - the XUID, in the form n1.n2.n3... (optional)
  482.     encodingname - the encoding for the font (optional)
  483.  
  484. Currently, the defined encodings are StandardEncoding, ISOLatin1Encoding,
  485. SymbolEncoding, and DingbatsEncoding. If the encoding is omitted,
  486. StandardEncoding is assumed.
  487.